package com.qcby.demo;

/**
 * 主类
 */
public class TransactionDemo {
    public static void main(String[] args) {
        TransactionManager transactionManager = new TransactionManager();

        // 添加操作
        transactionManager.addOperation(new SampleOperation("操作1", true));
        transactionManager.addOperation(new SampleOperation("操作2", true));
        transactionManager.addOperation(new SampleOperation("操作3", false)); // 模拟失败的操作
        transactionManager.addOperation(new SampleOperation("操作4", true));

        // 执行事务
        transactionManager.execute();
    }
}
